package meituan1.problem4;

import java.util.Scanner;

/**
 *
 */
public class Main {
    private static int totalNum = 0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        totalNum = sc.nextInt();
        int pickNum = sc.nextInt();
        int[] ballRecord = new int[totalNum];
        int temp1 = totalNum;
        while(temp1 -- > 0){
            ballRecord[totalNum - temp1 - 1] = sc.nextInt();
        }
        int[] curRecord = new int[ballRecord.length];
        int maxRes = 0;
        for(int i = 1; i <= pickNum; i++){
            curRecord = getRes(ballRecord, curRecord, i);
            maxRes = Math.max(maxRes, getMax(curRecord));
        }
        System.out.println(maxRes);

    }
    // 返回一个int[] , 表示length长度下, 运算以每个位置结尾的大小
    public static int[] getRes(int[] ballRecord, int[] preRecord, int length){
        if(length == 1) return ballRecord;
        int[] curRecord = new int[totalNum];
        for (int i = 0; i < length - 1; i++) {
            curRecord[i] = preRecord[i];
        }
        for(int i = length - 1; i < totalNum; i++){
            curRecord[i] = preRecord[i - 1] ^ ballRecord[i];
        }
        return curRecord;
    }
    public static int getMax(int[] input){
        int res = 0;
        for(int i: input){
            res = Math.max(i, res);
        }
        return res;
    }
}
